package tech.runchen.gz5055.oms.modules.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tech.runchen.gz5055.oms.common.annotation.RequiresPermissions;
import tech.runchen.gz5055.oms.common.base.AbstractController;
import tech.runchen.gz5055.oms.common.enums.UserType;
import tech.runchen.gz5055.oms.common.utils.MapUtils;
import tech.runchen.gz5055.oms.common.utils.Result;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author zzj
 */
@Api(tags = "管理平台 - 患者信息")
@RestController
@RequestMapping("/sys/patient")
public class SysPatientController extends AbstractController {

    @ApiOperation("患者列表")
    @RequiresPermissions(value = {UserType.SPD, UserType.NURSE})
    @GetMapping("/list")
    public Result list(@RequestParam Map<String, Object> params) {
        Object addressId = params.get("addressId");
        if (Objects.nonNull(addressId)) {
            List<Map<String, Object>> list = new ArrayList<>();
            list.add(new MapUtils().put("name", "张三").put("code", "47246234"));
            list.add(new MapUtils().put("name", "李四").put("code", "14122412"));
            list.add(new MapUtils().put("name", "王五").put("code", "75674745"));
            list.add(new MapUtils().put("name", "赵六").put("code", "34645376"));
            list.add(new MapUtils().put("name", "孙七").put("code", "43264262"));
            return Result.success(list);
        } else {
            return Result.error("请先选择配送地址");
        }
    }
}
